﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Data;

/// <summary>
/// Summary description for ThanhVienDAL
/// </summary>
public class ThanhVienDAL
{
	public ThanhVienDAL()
	{
		//
		// TODO: Add constructor logic here
		//
	}
    public DataTable fnG_GetDataThanhVien(ThanhVienEntity ThanhVien)
    {
        String sql = "SELECT * FROM ThanhVien where TenDangNhap=@a AND MatKhau=@b";
        return DataProvider.GetData(sql, "@a", ThanhVien.TenDangNhap, "@b", ThanhVien.MatKhau);
    }
    //update mat khau
    public int fnG_UpdateMatKhau(ThanhVienEntity ThanhVien)
    {
        string sql = "Update ThanhVien Set MatKhau=@MatKhau where TenDangNhap=@TenDangNhap;";
        return DataProvider.ExecuteNonQuery(sql, "@MatKhau", ThanhVien.MatKhau,"@TenDangNhap",ThanhVien.TenDangNhap);
    }//update thong tin
    public int fnG_UpdateThongTinTV(ThanhVienEntity ThanhVien)
    {
        string sql = "Update ThanhVien Set TenTV=@TenTV,Email=@Email,DiaChi=@DiaChi,DienThoai=@DienThoai,GioiTinh=@GioiTinh where TenDangNhap=@TenDangNhap;";
        return DataProvider.ExecuteNonQuery(sql, "@TenTV",ThanhVien.TenTV,"@Email",ThanhVien.Email,"@DiaChi",ThanhVien.DiaChi,"@DienThoai",ThanhVien.DienThoai,
            "@GioiTinh",ThanhVien.GioiTinh,"@TenDangNhap", ThanhVien.TenDangNhap);
    }

}